<?php
	//session_destroy();
	session_start();
	$_SESSION['value']="none";
	class EditViolationManager{
	
		public function validate($str,$param1,$num){
		
			if((!is_numeric($str))&&is_numeric($param1)&&is_numeric($num)&&($str!=""||$str!=null)){
					return true;
				}else{
					return false;
			}
		}

		public function editStudentForm1($str,$param1,$num){
			$num = $num-1;
			$conn = oci_connect("naiad", "1234", "localhost/XE");
			if((strcmp($str,"snum"))==0){
				$s = oci_parse($conn, "select STUDENTNO, DATEVIOLATION, NATURE, ACTIONTAKEN, DATEREPORTED FROM VIOLATION where STUDENTNO like '".$param1."'");
			}				
			
			oci_execute($s);
			$nrows = oci_fetch_all($s, $results);
			if($num>=$nrows||$num<0){
				echo"<script>alert(\"Invalid violation number!\")</script>";
				
			}else{
				$i = $num;
				if($nrows!=0){
					$_SESSION['studentno']=$results['STUDENTNO'][$i];
					$_SESSION['dateviolation']=$results['DATEVIOLATION'][$i];
					$_SESSION['nature']=$results['NATURE'][$i];
					$_SESSION['action']=$results['ACTIONTAKEN'][$i];
					$_SESSION['datereported']=$results['DATEREPORTED'][$i];
				
					return 1;
				}else{
					return 0;
				}
			}
		}//end of editStudentInfo function
			
	}//end of EditStudentManager class

?>